package entity;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;


public class EntityRepository<R, E> {
			
	private static HashMap<String, Entity> entities = new HashMap();

	public static <E> E createEntity(String name, EntityRepository entityRepository) {
		Entity entity = new Entity(entityRepository);
		entities.put(name, entity);
		return (E) entities.get(name);
	}
	
	public Collection<E> fetchAllEntities() {
		return (Collection<E>) entities.values();
	}
	

	private static HashMap<String, Class<Entity>> entityRepositoryCollection;
	
	private static HashMap<String, EntityRepository> repositories = new HashMap();

	public static <R> R createRepository(String name) {
		repositories.put(name, new EntityRepository());
		return (R) repositories.get(name);
	}
	
	public Collection<R> fetchAllRepositories() {
		return (Collection<R>) repositories.values();
	}

	public void store(Entity entity) {
		entities.put(entity.name, entity);
	}
	
}
